package com.alogic.loki.util;

/**
 * relabel规则
 *
 * @since 1.6.13.14 [20200907 duanyy] <br>
 */
public interface LokiRelabel {
    public enum Action {
        /**
         * 如果存在，则覆盖
         */
        overwrite,
        /**
         * 如果存在，保留原值
         */
        keep,
        /**
         * 删除label
         */
        delete
    };
    public String getKey();
    public String getValue();
    public boolean isRefValue();
    public Action getAction();

    /**
     * 缺省实现
     */
    public static class Default implements LokiRelabel {
        protected String key;
        protected String value;
        protected Action action;
        protected boolean ref = false;

        public Default(String key,String value,Action action){
            this.key = key;
            this.value = value;
            this.action = action;
        }

        public Default(String key,String value,Action action,boolean ref){
            this.key = key;
            this.value = value;
            this.action = action;
            this.ref = ref;
        }

        @Override
        public String getKey() {
            return key;
        }

        @Override
        public String getValue() {
            return value;
        }

        @Override
        public boolean isRefValue() {
            return ref;
        }

        @Override
        public Action getAction() {
            return action;
        }
    }
}
